-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: netlify-edge-functions-test for PRs and jest tests #3229
fix: netlify-edge-functions-test for PRs and jest tests #3229
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-3229--asyncapi-website.netlify.app/ |
@@ -1,20 +1,21 @@ | |||
name: Run tests for netlify edge-functions | |||
|
|||
on: | |||
workflow_dispatch | |||
pull_request: | |||
types: [opened, reopened, synchronize, ready_for_review] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to test netlify function this many times on each PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we calling in the actual netlify function while testing? Not sure, maybe @Shurtu-gal might help here.
Is that's not the case, then this is okay, since we do that number of times for jest tests also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual netlify function is not called at all. Instead the logic is tested through mocking.
website/netlify/edge-functions/tests/serve-definitions.test.ts
Lines 54 to 76 in 7b23c07
mf.install(); | |
mf.mock("*", (req) => { | |
console.log(req.url); | |
if (req.url === metricURL) { | |
metricCalls++; | |
} | |
const body = { | |
url: req.url, | |
method: req.method, | |
headers: req.headers, | |
}; | |
return new Response(JSON.stringify(body), { | |
status: 200, | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
}); | |
}); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarification @Shurtu-gal
@akshatnema I think we can then go for running netlify function tests for every PR this number of times. Afterall, they are taking around 11 seconds
/rtm |
Description